//
//  ImageTextField.m
//  credit
//
//  Created by scj on 2018/1/14.
//  Copyright © 2018年 scj. All rights reserved.
//

#import "ImageTextField.h"
@interface ImageTextField(){
    
}
@property(nonatomic,strong)UIImageView *imageView;
@end
@implementation ImageTextField{
    
}

/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect {
    // Drawing code
}
*/

- (instancetype)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self) {
        [self setUpView];
    }
    return self;
}

-(void)awakeFromNib{
    [super awakeFromNib];
    [self setUpView];
}

-(void)setUpView{
    UIView *leftView=[[UIView alloc]initWithFrame:CGRectMake(0, 0, 30, 25)];
    self.imageView=[[UIImageView alloc]initWithFrame:CGRectMake(0, 0, 25, 25)];
    [leftView addSubview:self.imageView];
    self.leftView=leftView;
    self.leftViewMode=UITextFieldViewModeAlways; //此处用来设置leftview现实时机
    self.contentVerticalAlignment = UIControlContentVerticalAlignmentCenter;
}


-(void)setTextImage:(NSString *)textImage{
    self.imageView.image=[UIImage imageNamed:textImage];
}


@end
